<script type="text/javascript" src="../../../tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
  tinyMCE.init({
    // General options
    mode : "textareas",
    theme : "advanced",
    plugin : "fullscreen",
    language : "pt",
    disk_cache : true,

    plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

    // Theme options
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,insertdate,inserttime,|,forecolor,backcolor,hr,|,sub,sup,|,iespell,fullscreen",
    theme_advanced_buttons2 : "",
    theme_advanced_buttons3 : "",
    theme_advanced_buttons4 : "",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : true,

    // Example content CSS (should be your site CSS)
    content_css : "css/content.css",

    // Drop lists for link/image/media/template dialogs
    template_external_list_url : "lists/template_list.js",
    external_link_list_url : "lists/link_list.js",
    external_image_list_url : "lists/image_list.js",
    media_external_list_url : "lists/media_list.js",

    // Replace values for the template plugin
    template_replace_values : {
      username : "Some User",
      staffid : "991234"
    }
  });
</script>

<% content_for :head do %>
<%= calendar_date_select_includes %>
<% end %>

<div class="yui-gc" style="width: 100%;">
  <div class="yui-u first" style="width: 68%;">
    
    <% f.field_container :name do %>
      <%= f.label :name, t("name") %> <span class="required">*</span><br />
      <%= f.text_field :name, :class => 'fullwidth title'  %>
      <%= f.error_message_on :name %>
    <% end %>

    <% f.field_container :description do %>
      <%= f.label :description, t("description")%><br />
      <%= f.text_area :description %>
      <a href="javascript:;" onmousedown="tinyMCE.get('product[description]').hide();">Esconder Editor</a> | <a href="javascript:;" onmousedown="tinyMCE.get('product[description]').show();">Mostrar Editor</a><br/>
      <%= f.error_message_on :description %>
    <% end %>
  </div>
  <div class="yui-u" style="width: 30%;">
        
    <% f.field_container :master_price do %>
      <%= f.label :master_price, t("master_price")%> <span class="required">*</span><br />
      <%= f.text_field :master_price  %>
      <%= f.error_message_on :master_price%>
    <% end %>

    <p>
      <%= f.label :available_on, t("available_on") %><br />
      <%= f.error_message_on :available_on %>
      <%= calendar_date_select :product, :available_on, :style=>"width:150px" %>
    </p>

    <% if @product.variant %>
    <p>
      <%= f.label :sku, t("sku") %><br />
      <%= f.text_field :sku, :size => 16 %>
    </p>
    <p>
      <%= f.label :on_hand, t("on_hand")%><br />
      <%= f.text_field :on_hand, :size => 4 %>        
    </p>
    <% end %>

    <p>
      <%= f.label :shipping_category_id, t("shipping_categories")%><br />    
      <%= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, {:include_blank => true}, {"style" => "width:200px"}) %>        
      <%= f.error_message_on :shipping_category %>
    </p>

    <p>
      <%= f.label :tax_category_id, t("tax_category")%><br />
      <%= f.collection_select(:tax_category_id, @tax_categories, :id, :name, {:include_blank => true}, {"style" => "width:200px"}) %>        
      <%= f.error_message_on :tax_category%>      
    </p>    
        
  </div>
</div>

<h2><%= t("metadata") %></h2>
<p>
  <%= f.label :meta_keywords, t("meta_keywords")%><br />
  <%= f.text_field :meta_keywords, :class => 'fullwidth' %>        
</p>
<p>
  <%= f.label :meta_description, t("meta_description")%><br />
  <%= f.text_field :meta_description, :class => 'fullwidth' %>        
</p>

<% Variant.additional_fields.select{|f| f[:only].nil? || f[:only].include?(:product) }.each do |field| %>
  <%= render :partial => "admin/shared/additional_field", :locals => {:field => field, :f => f} %>
<% end %>

<div id="image-listing">
  <%= render :partial => 'images', :locals => {:viewable => @product, :f => f} -%>
</div>
